One of my colleagues asks me this question and I've never seen such a code but it returns some results.
1) Run this simple code
* STATA code
sysuse auto2
count
if 0 {
display make in 1
}
if 1 {
display make in 1
}
2) In the result window, we get this
. clear
. sysuse auto2
(1978 Automobile Data)
. count
74
. if 0 {
. display make in 1
. }
. if 1 {
. display make in 1
AMC Concordinvalid syntax
r(198);
.
. }
r(198);
3) My question is, is there anybody who can explain what "If 0 {" and "If 1 {" mean? I don't know what condition is applied In this if-loop. why do we get no errors when we use "If 0 {" and why do we get r(198) error code if we use "If 1 {"? When do we use such an if-statement using only 0 or 1 without variable name?
This is my 1st post in this forum and thanks in advance!
Connor
1) Run this simple code
* STATA code
sysuse auto2
count
if 0 {
display make in 1
}
if 1 {
display make in 1
}
2) In the result window, we get this
. clear
. sysuse auto2
(1978 Automobile Data)
. count
74
. if 0 {
. display make in 1
. }
. if 1 {
. display make in 1
AMC Concordinvalid syntax
r(198);
.
. }
r(198);
3) My question is, is there anybody who can explain what "If 0 {" and "If 1 {" mean? I don't know what condition is applied In this if-loop. why do we get no errors when we use "If 0 {" and why do we get r(198) error code if we use "If 1 {"? When do we use such an if-statement using only 0 or 1 without variable name?
This is my 1st post in this forum and thanks in advance!
Connor
Comment